﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Sub_main.master" AutoEventWireup="true" CodeFile="Donvithongke.aspx.cs" Inherits="Donvithongke" %>
<%@import Namespace="System.Linq" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <%-- đặt tag link ở đây để tránh đụng csstable với google search box --%>
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <link href='<%= Page_url.local+"css/table.css"%>' rel="stylesheet" type="text/css" />
            <div id="slider" style="width: 100% !important; border: none !important; margin: 0 auto !important;">
                <div id="post_wrapper" style="width: 100% !important; border: none !important;">
                    <div class="post_news" style="width: 100% !important; border: none !important;">


                        <!--Nhớ đặt id là list cho table nhé-->
                        <table id="list" cellspacing='0' style="table-layout: fixed; width: 100%; margin-top: 15px;">
                            <!-- cellspacing='0' is important, must stay -->

                            <%
                         
                            
                                int trang = Convert.ToInt32(Request.QueryString["page"]);
                                int sobaihienthi = 10;
                                int batdau = trang * sobaihienthi;
                                BieumauDataContext db = new BieumauDataContext();
                                int total = 0;
                                total = db.tblCoQuanNhaNuocs.Count();
                                int set = 1;
                                if (total == 1)
                                {
                                    set = total;
                                }
                                else if (total > 1)
                                {
                                    set = total / sobaihienthi;
                                }
                                var dvnn = from p in db.tblCoQuanNhaNuocs.Skip(batdau).Take(sobaihienthi) select p;
                            %>
                            <tr>

                                <th style="width: 180px;"></th>
                                <th style="width: 70px; height: 10px;">&nbsp;</th>
                                <th style="text-align: left;">
                                    <h3>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Danh sách các đơn vị thực hiện báo cáo thống kê</h3>
                                </th>
                            </tr>
                            <%
                                    
                                foreach (var dv in dvnn)
                                {
                            %>
                            <!-- Table Header -->

                            <!-- Table Row -->



                            <tr>
                                <td style="width: 20px;" rowspan="5">
                                    <a href="<%=dv.Website %>">
                                        <img src="<%=dv.Logo %>" width="180" height="160" /></a></td>
                                <td style="width: 82px" align="right">
                                    <h5>Tên đơn vị:</h5>
                                </td>
                                <td style="width: 292px"><%=dv.TenCoQuan %></td>
                            </tr>

                            <tr>
                                <td style="width: 82px; height: 21px;" align="right">
                                    <h5>Website:</h5>
                                </td>
                                <td style="width: 292px; height: 21px;"><%=dv.Website %></td>
                            </tr>
                            <tr>
                                <td style="width: 82px; height: 17px;" align="right">
                                    <h5>Điện thoại:</h5>
                                </td>
                                <td style="width: 292px; height: 17px;"><%=dv.SDT %></td>
                            </tr>
                            <tr>
                                <td style="width: 82px" align="right">
                                    <h5>Email:</h5>
                                </td>
                                <td style="width: 292px"><a href=""><%=dv.email %></a></td>
                            </tr>

                            <tr>
                                <td style="width: 82px" align="right">
                                    <h5>Địa chỉ:</h5>
                                </td>
                                <td style="width: 292px"><%=dv.DiaChi %></td>
                            </tr>
                            <tr style="height: 15px; background-color: black !important;">
                                <td colspan="3"></td>
                            </tr>
                            <!--End_group-->
                            <%
                    

                                }
                                
                            %>
                        </table>

                        <div id="paging_2">
                            <center>
                                <ul>

                                    <%
                          
                                        int n = Convert.ToInt32(Request.QueryString["page"]);
                                        if (n <= 3)
                                        {
                                            Response.Write("<li><a href='Donvithongke.aspx?page=0' >« Trang đầu</a></li>");
                                            if (set <= 5)
                                            {
                                                for (int i = 1; i < set; i++)
                                                {

                                                    Response.Write("<li><a ");
                                                    if (i == Convert.ToInt32(Request.QueryString["page"].ToString()))
                                                    {
                                                        Response.Write("class='actived_page' href='Trangchu.aspx?page=" + i + "'>" + i + "</a></li>");
                                                    }
                                                    else
                                                    {
                                                        Response.Write("href='Donvithongke.aspx?page=" + i + "'>" + i + "</a></li>");
                                                    }



                                                }
                                            }
                                            else
                                            {

                                                for (int i = 1; i <= 5; i++)
                                                {

                                                    Response.Write("<li><a ");
                                                    if (i == Convert.ToInt32(Request.QueryString["page"].ToString()))
                                                    {
                                                        Response.Write("class='actived_page' href='Trangchu.aspx?page=" + i + "'>" + i + "</a></li>");
                                                    }
                                                    else
                                                    {
                                                        Response.Write("href='Donvithongke.aspx?page=" + i + "'>" + i + "</a></li>");
                                                    }



                                                }
                                            }
                                            Response.Write("... <li><a href='Donvithongke.aspx?page=" + set + "'>Trang cuối »</a></li>");
                                        }
                                        else
                                        {


                                            Response.Write("<li><a href='Donvithongke.aspx?page=0' >« Trang đầu</a></li>");
                                            for (int i = n - 2; i <= n + 2; i++)
                                            {
                                                if (i == set)
                                                    break;
                                                Response.Write("<li><a ");
                                                if (i == Convert.ToInt32(Request.QueryString["page"].ToString()))
                                                {
                                                    Response.Write("class='actived_page' href='Trangchu.aspx?page=" + i + "'>" + i + "</a></li>");
                                                }
                                                else
                                                {
                                                    Response.Write("href='Donvithongke.aspx?page=" + i + "'>" + i + "</a></li>");
                                                }



                                            }

                                            Response.Write("... <li><a href='Donvithongke.aspx?page=" + set + "'>Trang cuối »</a></li>");

                                        }
                            
                           
                                    %>
                                </ul>
                            </center>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>


